# pkg obj
PkgObj=$(LosuSDK_Obj)/sdk/losuh
# compiler
cxx=c++

# files
cxxFile=$(shell ls src/*.cc)
cxxIncFile=$(shell ls include/*.hh)

# flags
cxxWarning=-Wall
cxxStd= -std=c++14
cxxOpt= -O2
cxxInclude= -Iinclude -I$(LosuSDK_Include)
cxxFlags= $(cxxWarning) $(cxxStd) $(cxxOpt) $(cxxInclude)

#target
$(LosuSDK_Path)/losuh:\
	$(PkgObj)/hCodegen.o  	  \
	$(PkgObj)/hError.o    	  \
	$(PkgObj)/hLexer.o    	  \
	$(PkgObj)/hParser.o   	  \
	$(PkgObj)/main.o   	      \

	$(cxx) -o $@ $^



$(PkgObj)/hCodegen.o: src/hCodegen.cc $(cxxIncFile)
	$(cxx) $(cxxFlags) -c $< -o $@
	
$(PkgObj)/hError.o: src/hError.cc $(cxxIncFile)
	$(cxx) $(cxxFlags) -c $< -o $@


$(PkgObj)/hLexer.o: src/hLexer.cc $(cxxIncFile)
	$(cxx) $(cxxFlags) -c $< -o $@


$(PkgObj)/hParser.o: src/hParser.cc $(cxxIncFile)
	$(cxx) $(cxxFlags) -c $< -o $@

$(PkgObj)/main.o: main.cc $(cxxIncFile)
	$(cxx) $(cxxFlags) -c $< -o $@
	